const { Service } = require('egg');

class OfficialBeerService extends Service {
  async list(where) {
    const results = await this.app.mysql.select('official_beer', {
      where,
    });

    return results;
  }

  async detail(id) {
    const results = await this.app.mysql.select('official_beer', {
      where: {
        id,
      },
    });

    return results?.[0] || null;
  }

  async add(data) {
    const results = await this.app.mysql.insert('official_beer', data);

    return results;
  }
}

module.exports = OfficialBeerService;
